import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;


public class InputHandler implements KeyListener{
	
	public boolean forward = false, backward = false, left = false, right = false;
	
	public void keyPressed(KeyEvent e) {
		int keyCode = e.getKeyCode();
		
		if(keyCode == KeyEvent.VK_W || keyCode == KeyEvent.VK_UP)
		{
			forward = true;
		}else if(keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_DOWN)
		{
			backward = true;
		}else if(keyCode == KeyEvent.VK_D || keyCode == KeyEvent.VK_RIGHT)
		{
			left = true;
		}else if(keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_LEFT)
		{
			right = true;
		}
	}

	
	public void keyReleased(KeyEvent e) {
		int keyCode = e.getKeyCode();
		
		if(keyCode == KeyEvent.VK_W || keyCode == KeyEvent.VK_UP)
		{
			forward = false;
		}else if(keyCode == KeyEvent.VK_S || keyCode == KeyEvent.VK_DOWN)
		{
			backward = false;
		}else if(keyCode == KeyEvent.VK_D || keyCode == KeyEvent.VK_RIGHT)
		{
			left = false;
		}else if(keyCode == KeyEvent.VK_A || keyCode == KeyEvent.VK_LEFT)
		{
			right = false;
		}
	}

	
	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}

}
